import request from '@/utils/request'
// 登录
export const register = ({ username, password, repassword }) => {
  return request.post('/api/reg', {
    username,
    password,
    repassword
  })
}
// 注册
export const login = ({ username, password }) => {
  return request.post('/api/login', {
    username,
    password
  })
}
// 更新用户信息
export const updateUserInfoAPI = ({ id, username, nickname, email, user_pic }) => {
  return request.put('/my/userinfo', {
    id,
    username,
    nickname,
    email,
    user_pic
  })
}

// 重置密码
export const resetPwdAPI = ({ old_pwd, new_pwd, re_pwd }) => {
  return request.patch('/my/updatepwd', {
    old_pwd,
    new_pwd,
    re_pwd
  })
}
// 更新用户头像
export const updateAvatarAPI = (avatar) => {
  return request.patch('/my/update/avatar', {
    avatar
  })
}
